﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace CivCraft
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    /// 
    public class Map : IDisposable
    {
        public int map_Width=15;
        public int map_Height=7;
        private Cell[,] cells;
        
        public ContentManager Content
        {
            get { return content; }
        }
        ContentManager content;

        public int GetCells(int x, int y)
        {
            return cells[x, y].height;
        }
        public char statCheck(int x, int y)
        {
            return cells[x, y].code;
        }
        public int remains(int x, int y)
        {
            return cells[x, y].fire;
        }

      

        public Map(IServiceProvider serviceProvider)
            
        {
            content = new ContentManager(serviceProvider, "Content");
            cells = new Cell[15, 7];
            for (int y = 0; y < map_Height; y++)
            {
                for (int x = 0; x < map_Width; x++)
                {
                    cells[x, y].code = 'N';
                    cells[x, y].height = 1;
                    cells[x, y].fire = 0;
                }
            }
            for (int y = 0; y < map_Height; y++)
            {
                for (int x = 4; x <= 10; x++){
                    cells[x, y].code = 'N';
                    cells[x, y].height = 5;
                    cells[x, y].fire = 0;
                }
            }
            for (int y = 1; y < 6; y++)
            {
                for (int x = 5; x <= 9; x++){
                    cells[x, y].code = 'N';
                    cells[x, y].height = 3;
                    cells[x, y].fire = 0;

                }
            }




            // TODO: Construct any child components here
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        /// 
        public void Dispose()
        {
            Content.Unload();
        }
        /*
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }*/

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void Update(GameTime gameTime)
        {
            // TODO: Add your update code here


        }
    }
}